﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DesignPatterns.Strategy
{
    public class CashReturn : CashSuper
    {
        private decimal moneyCondition;
        private decimal moneyReturn;

        public CashReturn(decimal moneyCondition, decimal moneyReturn)
        {
            this.moneyCondition = moneyCondition;
            this.moneyReturn = moneyReturn;
        }

        public override decimal AcceptCash(decimal money)
        {
            if (money >= moneyCondition)
            {
                return money - Math.Floor(money / moneyCondition) * moneyReturn;
            }
            else
            {
                return money;
            }
        }
    }
}
